APP=mdown
CLASS=Markdown
OUT_PATH=build/php
FILE=$OUT_PATH/$APP.php
TMP=tmp

rm `find $OUT_PATH -type f | sed /\\.svn/d`

haxe -cp src -main $CLASS --php-front $APP.php -php $OUT_PATH

sed /\?\>/d $FILE > $TMP

echo 'function mdown ($text) { return '$CLASS'::$instance->makeHtml($text); }
?>' >> $TMP

mv $TMP $FILE
